package com.djmw.mouse.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.djmw.mouse.entity.Company;

public interface CompanyDao extends PagingAndSortingRepository<Company, Long>, JpaSpecificationExecutor<Company> {

	@Modifying
	@Query("update Company company set company.status = ?2 where company.id = ?1")
	void changeStatus(Long id, int status);

	@Modifying
	@Query("update Company company set company.balance = company.balance + ?2 where company.id = ?1")
	void deposit(Long id, Double amount);
}
